package com.huanling.main.exception;

/**
 * @author guibo.sun
 * @since 25 七月 2021
 */
public class ConflictKeyException extends RuntimeException {

    private String msg;

    private int code;

    public String getMsg() {
        return msg;
    }

    public ConflictKeyException setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public int getCode() {
        return code;
    }

    public ConflictKeyException setCode(int code) {
        this.code = code;
        return this;
    }

    public static ConflictKeyException of(int code) {
        return new ConflictKeyException().setCode(code);
    }

    public static ConflictKeyException of(String msg) {
        return new ConflictKeyException().setMsg(msg);
    }

    public static ConflictKeyException of(int code, String msg) {
        return new ConflictKeyException().setMsg(msg).setCode(code);
    }

    public void throwException() {
        throw this;
    }

}
